import getpass


def id():
    for i in password:
        if i.isdigit():
            return 1


def ia():
    for i in password:
        if i.isalpha():
            return 1


def da():
    for i in password:
        if (not i.isdigit()) and (not i.isalpha()):
            return 1


while True:
    username = input("请输入你的用户名（英文）：\n")
    if username.isalpha():
        password = getpass.getpass("请输入你的密码(需包含数字字母和特殊符号且密码长度大于12)：\n")
        while True:
            if ia() != 1 and id() != 1:
                password = getpass.getpass("请在密码中输入数字和字母:\n")
                continue
            elif ia() != 1 and da() != 1:
                password = getpass.getpass("请在密码中输入字母和特殊字符:\n")
                continue
            elif id() != 1 and da() != 1:
                password = getpass.getpass("请在密码中输入数字和特殊字符:\n")
                continue
            elif id() != 1:
                password = getpass.getpass("请在密码中输入数字:\n")
                continue
            elif ia() != 1:
                password = getpass.getpass("请在密码中输入字母:\n")
                continue
            elif da() != 1:
                password = getpass.getpass("请在密码中输入特殊字符:\n")
                continue
            if len(password) < 12:
                password = getpass.getpass("请输入大于12位的密码长度:\n")
                continue
            else:
                userage = input("请输入你的年龄：\n")
                while True:
                    if userage.isdigit() and int(userage) > 0:
                        print("你的用户名是{}，你的密码是{}，你的密码长度是{}，你的年龄是{}".format(username.upper(), password, len(password), userage))
                        exit(0)
                    else:
                        userage = input("请输入合法的年龄:\n")
    else:
        print("请输入合法的用户名！")
